//import Vector2d;

/**
 * 
 */

class Point{
	/**
	 * 
	 */
	private final rgbEditor rgbEditor;
	public Vector2d pos;
	public int type;
	public int color;//color identifier if a particle
	public int index;//Position in myPoints arraylist
	public int particleIndex; //if this is an actual particle, what number is it?
	public float pointRadius;//Drawn radius in screen coordinates
	
	//Particle variables
	public float mass;
	public boolean collideWithSolidStruts;
	public boolean collideWithWalls;

	{
		pointRadius = 5;
	}

	public Point(rgbEditor rgbEditor, Vector2d p){
		this.rgbEditor = rgbEditor;
		pos = new Vector2d(p);
		type = this.rgbEditor.NONE;
		index = -1;
		particleIndex = -1;
	}

	public Point(rgbEditor rgbEditor, Vector2d p, int t){
		this.rgbEditor = rgbEditor;
		pos = new Vector2d(p);
		type = t;
		index = -1;
		particleIndex = -1;
	}

	public void draw(){
		setDrawingMode();
		Vector2d pointScreen = this.rgbEditor.transform(this.pos);
		float d = pointScreen.distanceTo(new Vector2d(this.rgbEditor.mouseX,this.rgbEditor.mouseY));
		float factor = 1.0f / (1.5f + .01f*d);
		if (d < pointRadius) {this.rgbEditor.fill(255,255,255,100); factor = 1.0f;}
		this.rgbEditor.drawCircle(pos.x,pos.y,factor*pointRadius);
	}
	public String toString(){
		String res;
		res = String.valueOf(Math.round(pos.x)) + ","+String.valueOf(Math.round(pos.y));
		return res;
	}
	private void setDrawingMode(){
		if (color == rgbEditor.RED) this.rgbEditor.fill(255,0,0);
		else if (color == rgbEditor.GREEN) this.rgbEditor.fill(0,255,0);
		else if (color == rgbEditor.BLUE) this.rgbEditor.fill(0,0,255);
		else this.rgbEditor.fill(255,255,255,50);
		this.rgbEditor.stroke(255);
		//fill(255,255,255,100.0 - 2*transform(pos).distanceTo(new Vector2d(mouseX,mouseY)));
	}

}